package com.apes.fn.tms.model;


import com.apes.framework.jpa.BaseModel;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * 运单线路规划日志
 * @author yiny
 * 2020.3.29
 */
@Setter
@Getter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = WaybillPlanningLog.CONST_TABLE_NAME)
public class WaybillPlanningLog extends BaseModel {
    public static final String CONST_TABLE_NAME = "TMS_WAYBILL_PLANNING_LOG";

    @Id
    @Column(name = "id")
    @ApesGenerator(code = CONST_TABLE_NAME, name = "运单线路规划日志")
    @Comment("运单规划日志编码")
    private String id;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "waybill_id", referencedColumnName = "id")
    @Comment("运单号")
    private Waybill waybillId;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "car_details_id",referencedColumnName = "id")
    @Comment("派车信息编码")
    private CarDetails carDetailsId;

    @Column(name = "notes")
    @Comment("备注")
    private String notes;

}
